using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fated.SaveEngine;

namespace Fated.Character {
    public class CharacterClass : IJSON {
        private const string NameKey = "name";
        private const string ExpKey = "exp";
        private const string BoughtMovesKey = "boughtmoves";

        public string Name { get; set; }
        private int exp;
        private List<string> boughtMoves;

        public CharacterClass() {
        }

        public CharacterClass(string name) {
            this.Name = name;
            this.exp = 0;
            boughtMoves = new List<string>();

            ClassMngr.loadCharacterClass(Name);
        }
        public CharacterClass(Dictionary<String, Object> input) {
            this.Name = (string)input[NameKey];
            this.exp = (int)input[ExpKey];
            this.boughtMoves = (List<string>)input[BoughtMovesKey];

            ClassMngr.loadCharacterClass(Name);
        }

        public List<string> Abilities {
            get { return boughtMoves; }
        }
        public float Health {
            get { return ClassMngr.getHealth(Name); }
        }
        public float Magic {
            get { return ClassMngr.getMagic(Name); }
        }
        public float Body {
            get { return ClassMngr.getBody(Name); }
        }
        public float Mind {
            get { return ClassMngr.getMind(Name); }
        }
        public float Spirit {
            get { return ClassMngr.getSpirit(Name); }
        }
        public float Social {
            get { return ClassMngr.getSocial(Name); }
        }
        public float Speed {
            get { return ClassMngr.getSpeed(Name); }
        }

        public int ExperienceSpent {
            get { return exp; }
        }
        public Dictionary<string, object> ToJSON() {
            Dictionary<string, object> output = new Dictionary<string, object>();
            output.Add(NameKey, this.Name);
            output.Add(ExpKey, this.exp);
            output.Add(BoughtMovesKey, this.boughtMoves);

            return output;
        }

    }
}
